package com.zhoujie.roomdemo.db;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import java.util.List;

@Dao
public interface UserDao {

    @Query("select * from User")
    List<User> getAll();

    @Query("select account from User")
    List<String> getAllAccount();

    @Query("select pwd from User where :account = account")
    String getPwdByAccount(String account);

    @Insert(onConflict = OnConflictStrategy.IGNORE)
    void insertUser(User... users);

    @Delete
    void deleteUser(User... users);

    @Query("delete from user")
    void clearUser();
}
